<template>
    <view>
        <mescroll-uni
            ref="mescrollRef"
            @init="mescrollInit"
            :height="height"
            :down="downOption"
            @down="downRefresh"
            :up="upOption"
            @up="getData">
            <view class="wrapper">
                <view class="list" @click="goDetail(item)" v-for="(item, index) in datas">
                    <view class="left">
                        <view class="price-tle">{{ moneyType == 0 ? "付款金额" : "退款金额" }}</view>
                        <view class="price">￥{{ item.Money }}</view>
                    </view>
                    <view class="right">
                        <view class="right-item" v-if="moneyType == 0">订单号：{{ item.OrderSn }}</view>
                        <view class="right-item" v-if="moneyType == 1 && item.ExchangeEn"
                            >退单号：{{ item.ExchangeEn }}</view
                        >
                        <view class="right-item" v-if="moneyType == 1">关联单号：{{ item.OrderSn }}</view>
                        <view class="right-item">支付时间：{{ item.AddTime }}</view>
                    </view>
                </view>
            </view>
        </mescroll-uni>
    </view>
</template>
<script>
import { GetRecodePage } from "@/pages_supplier/service/api/period.js"
export default {
    props: {
        height: {
            type: String,
            default: "100px",
        },
        requestData: {
            type: Object,
            default: {},
        },
        moneyType: {
            type: Number,
            default: 0,
        },
    },
    components: {},
    data() {
        return {
            datas: [],
            data: [],
            productList: [],
            param: {},
            downOption: {
                use: true,
            },
        }
    },
    mounted() {
        //#ifndef MP
        this.refresh(this.requestData)
        //#endif
        console.log(this.state)
    },
    methods: {
        //获取列表数据
        getData(page) {
            let param = this.param
            param.pageSize = page.size
            param.pageIndex = page.num
            param.moneyType = this.moneyType
            GetRecodePage(param).then((res) => {
                if (res.State == 1) {
                    this.mescroll.endBySize(res.Data.length, res.RecordAmout)
                    this.datas = this.datas.concat(res.Data)
                    console.log(this.datas)
                } else {
                    this.mescroll.endBySize(0, 0)
                }
            })
        },

        //刷新
        refresh(requestData) {
            this.downRefresh(requestData, true)
        },
        //刷新
        downRefresh(requestData, isSetParam = false) {
            this.datas = []
            if (isSetParam) {
                this.param = requestData
            }
            this.mescroll.resetUpScroll()
        },
    },
}
</script>

<style lang="scss">
.wrapper {
    padding: 24rpx;
}

.list {
    margin-bottom: 16rpx;
    background: #ffffff;
    border-radius: 16rpx;
    padding: 26rpx 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .left {
        text-align: center;
        min-width: 40%;
        box-sizing: border-box;
        padding: 0 20rpx;
        border-right: 1px dashed #ebebeb;
        .price-tle {
            font-size: 28rpx;
            padding-bottom: 6rpx;
        }
        .price {
            font-weight: 600;
            font-size: 36rpx;
        }
    }
    .right {
        flex: 1;
        padding: 0 20rpx;
        .right-item {
            font-size: 24rpx;
            color: $color-gray-3;
            &:not(:first-child) {
                padding-top: 16rpx;
            }
        }
    }
}
</style>
